﻿using System.Data;
using System.Web.Script.Serialization;

namespace yeqw.FrameWork
{
    public static class DataTableExtensions
    {
        /// <summary>
        /// IsNullOrEmpty
        /// </summary>
        /// <returns></returns>
        public static bool IsNullOrEmpty(this DataTable dataTable)
        {
            return dataTable == null || dataTable.Rows.Count < 1;
        }
        /// <summary>
        /// ToJSON
        /// </summary>
        /// <param name="input"></param>
        /// <param name="parrtern"></param>
        /// <returns></returns>
        public static string ToJSON(this DataTable dataTable)
        {

            return JsonHelper.DataTableToJsonStr(dataTable);
            //JavaScriptSerializer json = new JavaScriptSerializer();
            //return json.Serialize(dataTable); 
        }

    }
}
